#ifndef _SIMPLESC_H_
#define _SIMPLESC_H_

#include "InitSockets.h"

#define MAXSIZERECV 128

class SimpleServer
{
public:
	inline SimpleServer(){state = STATE_NONE; sock = 0;}
	bool Listen(const char* addr);
	bool isRead();
	bool Accept(CSocket &cSock);
	bool Send(CSocket cSock, const char* buf, int len);
	char* Recv(CSocket cSock, int &len, int maxlen);
	inline SOCKET getSocket(){return sock;}
	inline int getState(){return state;}
private:
	SOCKET sock;
	int state;
};

class SimpleClient
{
public:
	inline SimpleClient(){state = STATE_NONE;sock = 0;}
	bool Connect(const char* addr);
	bool isRead();
	bool Send(const char* buf, int len);
	char* Recv(int &len, int maxlen);
	inline SOCKET getSocket(){return sock;}
	inline int getState(){return state;}
private:
	CSocket cSock;
	SOCKET sock;
	int state;
};
#endif